<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
  --time: 30s;
}
.target {
  --time: 10s;
}
</style>
<body>
<script src="../interpolation/resources/interpolation-test.js"></script>
<script>
CSS.registerProperty({
  name: '--time',
  syntax: '<time>',
  initialValue: '40s',
  inherits: false,
});

assertInterpolation({
  property: '--time',
  from: neutralKeyframe,
  to: '20s',
}, [
  {at: -0.3, is: '7s'},
  {at: 0, is: '10s'},
  {at: 0.5, is: '15s'},
  {at: 1, is: '20s'},
  {at: 1.5, is: '25s'},
]);

assertInterpolation({
  property: '--time',
  from: 'initial',
  to: '20s',
}, [
  {at: -0.3, is: '46s'},
  {at: 0, is: '40s'},
  {at: 0.5, is: '30s'},
  {at: 1, is: '20s'},
  {at: 1.5, is: '10s'},
]);

assertInterpolation({
  property: '--time',
  from: 'inherit',
  to: '20s',
}, [
  {at: -0.3, is: '33s'},
  {at: 0, is: '30s'},
  {at: 0.5, is: '25s'},
  {at: 1, is: '20s'},
  {at: 1.5, is: '15s'},
]);

assertInterpolation({
  property: '--time',
  from: 'unset',
  to: '20s',
}, [
  {at: -0.3, is: '46s'},
  {at: 0, is: '40s'},
  {at: 0.5, is: '30s'},
  {at: 1, is: '20s'},
  {at: 1.5, is: '10s'},
]);

assertInterpolation({
  property: '--time',
  from: '-10s',
  to: '10s',
}, [
  {at: -0.3, is: '-16s'},
  {at: 0, is: '-10s'},
  {at: 0.5, is: '0s'},
  {at: 1, is: '10s'},
  {at: 1.5, is: '20s'},
]);

assertInterpolation({
  property: '--time',
  from: '100ms',
  to: '200ms',
}, [
  {at: -0.3, is: '0.07s'},
  {at: 0, is: '0.1s'},
  {at: 0.5, is: '0.15s'},
  {at: 1, is: '0.2s'},
  {at: 1.5, is: '0.25s'},
]);

assertInterpolation({
  property: '--time',
  from: '1000ms',
  to: '11s',
}, [
  {at: -0.3, is: '-2s'},
  {at: 0, is: '1s'},
  {at: 0.5, is: '6s'},
  {at: 1, is: '11s'},
  {at: 1.5, is: '16s'},
]);
</script>
</body>
